package com.ruoyi.system.service.aid.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.aid.AidReceiptMapper;
import com.ruoyi.system.domain.aid.AidReceipt;
import com.ruoyi.system.service.aid.IAidReceiptService;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;

/**
 * 物资接收Service业务层处理
 * 
 * @author ruoyi
 */
@Service
public class AidReceiptServiceImpl implements IAidReceiptService {
    @Autowired
    private AidReceiptMapper aidReceiptMapper;

    /**
     * 查询物资接收列表
     * 
     * @param aidReceipt 物资接收
     * @return 物资接收
     */
    @Override
    public List<AidReceipt> selectAidReceiptList(AidReceipt aidReceipt) {
        return aidReceiptMapper.selectAidReceiptList(aidReceipt);
    }

    /**
     * 查询物资接收详细
     * 
     * @param receiptId 接收编号
     * @return 物资接收
     */
    @Override
    public AidReceipt selectAidReceiptById(Long receiptId) {
        return aidReceiptMapper.selectAidReceiptById(receiptId);
    }

    /**
     * 新增物资接收
     * 
     * @param aidReceipt 物资接收
     * @return 结果
     */
    @Override
    public int insertAidReceipt(AidReceipt aidReceipt) {
        aidReceipt.setCreateTime(DateUtils.getNowDate());
        aidReceipt.setCreateBy(SecurityUtils.getUsername());
        return aidReceiptMapper.insertAidReceipt(aidReceipt);
    }

    /**
     * 修改物资接收
     * 
     * @param aidReceipt 物资接收
     * @return 结果
     */
    @Override
    public int updateAidReceipt(AidReceipt aidReceipt) {
        aidReceipt.setUpdateTime(DateUtils.getNowDate());
        aidReceipt.setUpdateBy(SecurityUtils.getUsername());
        return aidReceiptMapper.updateAidReceipt(aidReceipt);
    }

    /**
     * 批量删除物资接收
     * 
     * @param receiptIds 需要删除的接收编号
     * @return 结果
     */
    @Override
    public int deleteAidReceiptByIds(Long[] receiptIds) {
        return aidReceiptMapper.deleteAidReceiptByIds(receiptIds);
    }

    /**
     * 删除物资接收信息
     * 
     * @param receiptId 接收编号
     * @return 结果
     */
    @Override
    public int deleteAidReceiptById(Long receiptId) {
        return aidReceiptMapper.deleteAidReceiptById(receiptId);
    }

    /**
     * 根据仓库ID查询入库记录
     * 
     * @param warehouseId 仓库ID
     * @return 入库记录列表
     */
    @Override
    public List<AidReceipt> selectReceiptByWarehouseId(Long warehouseId) {
        // 由于没有直接的仓库ID查询方法，这里暂时返回空列表
        return null;
    }

    /**
     * 根据状态查询接收记录
     * 
     * @param status 状态
     * @return 物资接收集合
     */
    @Override
    public List<AidReceipt> selectAidReceiptByStatus(String status) {
        return aidReceiptMapper.selectAidReceiptByStatus(status);
    }
} 